<?php
	/**
	*Author 雷日锦 362606856@qq.com 
	*控制器自动生成
	*/
	if(!defined("ROOT_PATH")) exit("die Access ");
	class ymdian_weiguiControl extends skymvc{
		
		public function __construct(){
			parent::__construct();
		}
		
		public function onDefault(){
			$where=" siteid=".SITEID;
			$url=ADMIN."?m=ymdian_weigui&a=default";
			$limit=20;
			$start=get("per_page","i");
			$option=array(
				"start"=>intval(get_post('per_page')),
				"limit"=>$limit,
				"order"=>" id DESC",
				"where"=>$where
			);
			$rscount=true;
			$data=M("ymdian_weigui")->select($option,$rscount);
			if($data){
				foreach($data as $v){
					$shopids[]=$v['shopid'];		
				}
				$shops=M("ymdian")->getShopByIds($shopids);
				foreach($data as $k=>$v){
					$v['shop_name']=$shops[$v['shopid']]['title'];
					$data[$k]=$v;
				}
				
			}
			$pagelist=$this->pagelist($rscount,$limit,$url);
			$this->smarty->assign(
				array(
					"data"=>$data,
					"pagelist"=>$pagelist,
					"rscount"=>$rscount,
					"url"=>$url,
					 
				)
			);
			$this->smarty->display("ymdian_weigui/index.html");
		}
		
		
	}

?>